import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter3 } from '@/utils/formatTime'

// 表单校验
export const rules = reactive({
  type: [required],
  name: [required],
  content: [required],
  idCardUrl1: [required],
  idCardUrl2: [required],
  status: [required],
})

// CrudSchema https://doc.iocoder.cn/vue3/crud-schema/
const crudSchemas = reactive<CrudSchema[]>([
  // {
  //   label: '编号',
  //   field: 'id',
  //   isForm: false,
  // },
  {
    label: '公益类型',
    field: 'type',
    isSearch: true,
    dictType: DICT_TYPE.GONGYI_STATUS,
    form: {
      component: 'Select'
    },
    search:{
      component:"Select",
      formItemProps:{
        style:{
          width:'300px'
        }
      }
    },
    table:{
      width:'100px'
    }
  },
  {
    label: '用户',
    field: 'name',
    isSearch: true,
    table:{
      width:'120px'
    }
  },
  
  {
    label: '手机号码',
    field: 'phone',
    isSearch: true,
    table:{
      width:'180px'
    }
  },
  {
    label:'提供材料',
    field: 'file',
    isForm: false,
    table:{
      width:'180px'
    }
  },
  {
    label: '线索详情',
    field: 'content',
    isSearch: false,
    form: {
      component: 'Editor',
      componentProps: {
        valueHtml: '',
        height: 200
      }
    }
  },
  // {
  //   label: '用户身份证',
  //   field: 'idCard',
  //   isSearch: true,
  // },
  // {
  //   label: '身份证正面',
  //   field: 'idCardUrl1',
  //   isSearch: false,
  // },
  // {
  //   label: '身份证反面',
  //   field: 'idCardUrl2',
  //   isSearch: false,
  // },
  {
    label: '状态',
    field: 'status',
    dictType: DICT_TYPE.AUDIT,
    isSearch: true,
    form: {
      component: 'Select'
    },
    table:{
      width:'100px'
    },
    search:{
      component:"Select",
      formItemProps:{
        style:{
          width:'300px'
        }
      }
    }
  },
  

  {
    label: '提交时间',
    field: 'createTime',
    formatter: dateFormatter3,
    isTable:true,
    isSearch: false,
    search: {
      component: 'DatePicker',
      componentProps: {
        valueFormat: 'YYYY-MM-DD HH:mm',
        type: 'daterange',
        defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
      }
    },
    form: {
      component: 'DatePicker',
      componentProps: {
        type: 'datetime',
        valueFormat: 'x'
      }
    },
    table:{
      width:'180px',
    }
  },
  {
    label: '审核人',
    field: 'acceptUserName',
    isSearch: true,
    table:{
      width:'120px'
    }
  },
  {
    label: '审核时间',
    field: 'acceptTime',
    formatter: dateFormatter3,
    isTable:true,
    isSearch: false,
    search: {
      component: 'DatePicker',
      componentProps: {
        valueFormat: 'YYYY-MM-DD HH:mm',
        type: 'daterange',
        defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
      }
    },
    form: {
      component: 'DatePicker',
      componentProps: {
        type: 'datetime',
        valueFormat: 'x'
      }
    },
    table:{
      width:'180px'
    }
  },
  {
    label: '受理人id',
    field: 'acceptUserId',
    isTable:false,
    isSearch: false,
    form: {
      component: 'InputNumber',
      value: 0
    },
  },
  {
    label: '审核说明',
    field: 'acceptContent',
    isSearch: false,
    form: {
      component: 'Editor',
      componentProps: {
        valueHtml: '',
        height: 200
      }
    },
  },
  {
    label: '审核信息',
    field: 'auditingContent',
    isTable:false,
    isSearch: false,
    form: {
      component: 'Editor',
      componentProps: {
        valueHtml: '',
        height: 200
      }
    },
  },
  {
    label: '审核时间',
    field: 'auditingTime',
    formatter: dateFormatter3,
    isTable:false,
    isSearch: false,
    search: {
      component: 'DatePicker',
      componentProps: {
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
        type: 'daterange',
        defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
      }
    },
    form: {
      component: 'DatePicker',
      componentProps: {
        type: 'datetime',
        valueFormat: 'x'
      }
    },
  },
  {
    label: '创建时间',
    field: 'createTime',
    formatter: dateFormatter3,
    isTable:false,
    isSearch: false,
    search: {
      component: 'DatePicker',
      componentProps: {
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
        type: 'daterange',
        defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
      }
    },
    isForm: false,
  },
  {
    label: '操作',
    field: 'action',
    isForm: false,
    showOverflowTooltip:false,
    table:{
      width:"200px",
      fixed:"right",
    }
  }
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
